import java.awt.Image;
import java.util.ArrayList;
import java.awt.Color;
import org.w3c.dom.Element;

/**
 * Card that stores all the card data for a single
 * 
 * @author Sean Wheeler
 *
 */
public class Card 
{
	private String name, activeDescription, passiveDescription;
	private int egocost, priority;
	private ArrayList<EffectActive> actives;
	private ArrayList<EffectPassive> passives;
	private String type;
	private Image art;
	
	
	public Card(String name, String activeDescription, String passiveDescription, int egocost, int priority, String type)
	{
		this.name = name;
		this.activeDescription = activeDescription;
		this.passiveDescription = passiveDescription;
		this.egocost = egocost;
		this.priority = priority;
		this.type = type;
	}
	
	public Card(String name, String activeDescription, String passiveDescription, int egocost, int priority, String type, ArrayList<EffectActive> actives, ArrayList<EffectPassive> passives)
	{
		this(name, activeDescription, passiveDescription, egocost, priority, type);
		this.actives = actives;
		this.passives = passives;
	}
	
	public String getType(){
		return type;
	}
	
	public String getName()
	{
		return name;
	}
	
	public String getActiveDescription()
	{
		return activeDescription;
	}
	
	public String getPassiveDescription()
	{
		return passiveDescription;
	}
	
	public int getCost()
	{
		return egocost;
	}
	
	
	public Color getColor()
	{
		if (type.equals("Logic"))
		{
			return new Color(128,128,255);
		}
		else if (type.equals("Ethics"))
		{
			return new Color(255,255,128);
		}
		else if (type.equals("Passion"))
		{
			return new Color(255,128,128);
		}
		else if (type.equals("Deception"))
		{
			return new Color(128,128,128);
		}
		else
		{
			return Color.white;
		}
	}
	
	
	public String toString()
	{
		return name + ": cost=" + (int)(egocost * this.actives.get(0).user.egoCostRate);
	}
	
	public int getPriority(){
		return priority;
	}
	
	public ArrayList<EffectActive> getActives(){
		return actives;
	}
	
	public ArrayList<EffectPassive> getPassives(){
		return passives;
	}

	public void remake(Card card) {
		this.name = card.name;
		this.activeDescription = card.activeDescription;
		this.passiveDescription = card.passiveDescription;
		this.actives = card.actives;
		this.passives = card.passives;
		this.egocost = card.egocost;
		this.priority = card.priority;
		this.type = card.type;
		
	}
	
	
	public Card duplicate(){
		return new Card(this.name, this.activeDescription, this.passiveDescription, this.egocost, this.priority, this.type, this.actives, this.passives);
	}
}
